<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/templates/templateLayout.xhtml">


	<f:metadata>
		<f:event type="preRenderView" listener="#{tasaInteresBean.vermensaje()}" />
	</f:metadata>

	<ui:define name="centerContent">
		<h:panelGroup layout="block"
			class="title ui-widget-header ui-corner-all"
			style="padding: 8px; font-size: 16px !important; text-align: center;">
			<h:outputText value="#{msgs['title.tasainteres']}" />

			<h:form id="formentity">
				<p:growl showDetail="true" id="msgGrwl" />
				<p:messages id="messagesFilter" showDetail="true"  closable="true" showSummary="true"/>
				<ui:include src="/templates/toolbarSearch.xhtml">
					<ui:param name="bean" value="#{tasaInteresBean}" />
				</ui:include>


				<p:dataTable id="list" var="item" value="#{tasaInteresBean.list}"
					rowKey="#{item.id}" lazy="true" selectionMode="single"
					selection="#{tasaInteresBean.entity}" paginator="true"
					resizableColumns="false" rows="10" widgetVar="entityTable"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="10,20,30,50"
					paginatorPosition="bottom"  filterDelay="1000" emptyMessage="#{msgs['lista.vacia']}"
					sortBy="#{item.fecha}" sortOrder="descending">
					<p:ajax event="rowSelect" listener="#{tasaInteresBean.onRowSelect}"
						update=":formentity:msgGrwl" />
					<p:ajax event="filter" listener="#{tasaInteresBean.filterListener(':formentity:list')}" 
						update=":formentity:messagesFilter"/>
						
					<p:column headerText="#{msgs['form.fecha']}" id="fecha" sortBy="#{item.fecha}">
						<h:outputText value="#{item.fecha}">
							<f:convertDateTime  pattern="MM/yyyy"/>
						</h:outputText>						
					</p:column>
					<p:column headerText="#{msgs['tasa']}" id="tasa" sortBy="#{item.tasa}">
						<h:outputText value="#{item.tasa}">
							<f:convertNumber currencySymbol="%" type="currency" maxFractionDigits="2" />
						</h:outputText>						
					</p:column>
					<p:column width="60">
						<h:link outcome="create" title="Editar">
							<p:graphicImage library="images" name="edit-grid.png" />
							<f:param name="id" value="#{item.id}" />
						</h:link>
						<h:link outcome="view" title="Ver">
							<p:graphicImage library="images" name="view-grid.png" />
							<f:param name="id" value="#{item.id}" />
						</h:link>
						<p:commandLink action="#{tasaInteresBean.delete(item)}"
							update=":formentity"
							onstart="return confirm('#{msgs['confirmar.eliminar']}')">
							<p:graphicImage library="images" name="delete-grid.png" />
						</p:commandLink>
					</p:column>

				</p:dataTable>
			</h:form>
		</h:panelGroup>
	</ui:define>
	<ui:define name="dialogsDelete">
		<h:form id="diagolDeletes" prependId="false">
			<ui:include src="/pages/shared/commonPerson.xhtml">
				<ui:param name="bean" value="#{tasaInteresBean}" />
			</ui:include>
		</h:form>
	</ui:define>
</ui:composition>
</html>
